<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
  
</head>
<style>
   * {
        padding: 0;
        margin: 0;
    }

    body {
        background: #34495e;
    }

    main {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
    }

    main .btn {
        height: 30px;
        width: 150px;
        border: solid 2px #e74c3c;
        background: none;
        color: white;
        position: relative;
        text-align: center;
        display: flex;
        /* justify-content: center这个属性导致滑动的时候::before伪类元素的背景色从中间向两边移动 */
        justify-content: center; 
        align-items: center;
        overflow: hidden;
        cursor: pointer;
        box-shadow: 0 3px 8px rgba(0, 0, 0, .3);
    }

    main .btn::before {
        transition: all .8s;
        align-self: center;
        content: '';
        position: absolute;
        width: 0;
        height: 100%;
        background: #e74c3c;
        z-index: -1;
        transform: skewX(-45deg);
    }

    main .btn:hover::before {
        width: 200%;
    }
    main div{
        margin-top: 20px;
        background-color: aqua;
        width: 0;
        flex:1;
        transition: all .8s;
        overflow: hidden;
    }
    main:hover>div{
        width: 100px;
    }
    p{
        background-color: red;
        overflow: hidden;
    }

    .box {
        position: absolute;
        background-color: #e74c3c;
    }
 
    .box::after {
        display: block;
        width: 0;
        height: 4px;
        background-color: #da1818;
        content: "";
        position: absolute;
        bottom: -10px;
        /* 这个属性导致滑动的时候::after伪类元素的背景色从中间向两边移动  */
        left: 50%;
        transition: 1s;
    }
    .box:hover::after {
        width: 100%;
        left: 0;
    }
</style>
<body>
    <main>
        <a class="btn">
            HOUDUNREN
        </a>
        <div>11111111111</div>
    </main>
    <p style="width: 0px;">444444444444444444</p>
    <div class="box">
        hover 时出现下划线
    </div>
</body>
<script>
    

    
</script>
</html>
